package main.www.wonderfuldata.com;

import java.sql.Connection;
import java.sql.Driver;

import java.sql.SQLException;
import java.util.Properties;

public class testJDBC01 {
    public void testConnection1(){
        try{
            //先提供接口 Dirver
            Driver driver = null;
            driver = new com.mysql.jdbc.Driver();

            //url
            String url="jdbc:mysql://localhost:3306/test";

            //3.提供Properties的对象，指明用户名和密码
            Properties info = new Properties();

            info.setProperty("user","root");
            info.setProperty("password","123456");

            //4.调用driver的connect()，获取连接
            Connection conn = driver.connect(url,info);
            System.out.println(conn);
        }catch (SQLException e){
            e.printStackTrace();
        }
    }
}
